<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">     
<meta charset="utf-8">             
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">     
<meta content="yes" name="apple-mobile-web-app-capable">     
<meta content="black" name="apple-mobile-web-app-status-bar-style">     
<meta content="telephone=no" name="format-detection">
<head> 
<title>上传</title> 
<style> 
</style> 
</head> 
<script src="static/jquery-2.1.1.min.js" type="text/javascript"></script>
<body> 
<div style="height:10%"></div>
<div style="text-align:center" >
<form action="upload" method="post" enctype="multipart/form-data" >
<p>频道标识：<input type="text" name="gid"/> </p>
<p>视频标题：<input type="text" name="title"/> </p>
<p>视频标签：<input type="text" name="flag"/> </p>
<p>分类： &nbsp &nbsp
 <select name="class" id="class">
  {% for cls in classname %}
  <option value ="{{cls['class']}}"> &nbsp &nbsp{{cls['name']}}</option>
  {% end %}
</select>
</p>

<p>子分类： &nbsp &nbsp
 <select name="subclass" id="subclass">
</select>
</p>
<p><input type="file" name="video"/> </p>

<p><input type="submit" value="上传"/> </p>
</form>
</div>
<script>
$("#class").change(function(){//code...
svalue=$("#class").val();
$("#subclass").empty();
$.get("subclass?class=" + svalue, function(data){
    var dataObj=eval("("+data+")");
    subnames = dataObj['data'];
     $(subnames).each(function(i,n){
    $("#subclass").append("<option value='"+n['subclass'] + "'>" + n['name'] + "</option>");
  });
    
  });

}); 
$("#class").val("1");
svalue=$("#class").val();
$("#subclass").empty();
$.get("subclass?class=" + svalue, function(data){
    var dataObj=eval("("+data+")");
    subnames = dataObj['data'];
     $(subnames).each(function(i,n){
    $("#subclass").append("<option value='"+n['subclass'] + "'>" + n['name'] + "</option>");
  });
$("#subclass").val("1");})
 
</script>

</body> 
</html>
